package com.emm.yixun.mobile.ui.signed;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alibaba.fastjson.JSONObject;
import com.emm.yixun.mobile.R;
import com.emm.yixun.mobile.adapter.AnnexAdapter;
import com.emm.yixun.mobile.adapter.JJAdapter;
import com.emm.yixun.mobile.adapter.NewFromAdapter;
import com.emm.yixun.mobile.adapter.PhoneSelectAdapter;
import com.emm.yixun.mobile.application.EmmApplication;
import com.emm.yixun.mobile.base.BaseActivity;
import com.emm.yixun.mobile.model.AddpirModel;
import com.emm.yixun.mobile.model.BusinessAudit;
import com.emm.yixun.mobile.model.GetConsultantList;
import com.emm.yixun.mobile.model.GetConsultantList.ConsultantList;
import com.emm.yixun.mobile.model.GetSignedDetail;
import com.emm.yixun.mobile.model.NewClassKehuModel;
import com.emm.yixun.mobile.ui.RejectActivity;
import com.eroad.product.tools.MyGridView;
import com.eroad.product.tools.MyListView;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.yixun.app.viewpagerandimag.sample.ViewPagerActivity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import me.imid.swipebacklayout.lib.SwipeBackLayout;
import me.imid.swipebacklayout.lib.app.SwipeBackActivity;
import xf.tools.Loading;

/**
 * 
 * <p>
 * <b>Title：</b> 签约详情
 * </p>
 * <p>
 * <b>Description：</b>
 * </p>
 * 
 * @author tangxin
 * @date 2016年12月6日 下午4:10:08
 */
public class SigneDetailsdActivity extends SwipeBackActivity {

	private final static String TAG = "SigneDetailsdActivity";

	/** 签约ID */
	private String signId = "";

	/** 房源信息 */
	private boolean IsFangyuan = true;

	/** 客户信息 */
	private boolean IsKehu = true;

	/** 合同扫面 */
	private boolean IShtsm = true;

	/** 合同扫面件 */
	LinearLayout phone;
	RelativeLayout phone_layout;

	private boolean IsYEWU = true;

	/** 房源信息 */
	LinearLayout fangyuan, fangyuan_layout, yewu_type, yewu_linear;

	/** 客户信息 */
	LinearLayout kehu, kehu_layout;

	ImageView rt1, rt2, rt1_p, rt0, rt3;

	/** 扫面列表grid */
	MyGridView grid_phone;

	/** 合同扫面适配器 */
	PhoneSelectAdapter padapter;

	ArrayList<AddpirModel> ap;

	ImageView back_btn;

	TextView title_main;

	/** 家庭成员 */
	MyListView kehuxinxi;

	ArrayList<NewClassKehuModel> list = new ArrayList<NewClassKehuModel>();

	NewFromAdapter adapter;

	/*--------------------------------------------------------------------------------------------------*/
	/** 业务状态 */
	TextView yewu_view;

	/** 客户姓名 */
	TextView user_name;

	/** 星标 */
	TextView user_star;

	/** 性别 */
	TextView user_sex;

	/** 评分 */
	TextView user_number;

	TextView customerOrigin_view;

	TextView customerStatus_view;

	/** 电话号码 */
	TextView phone_tel;

	/** 认筹编号 */
	TextView payDepositCode_view;

	/** 认筹金 */
	TextView payDepositMoney_view;

	/** 认购编号 */
	TextView subscribeCode_view;

	/** 应收定金 */
	TextView subscribeAmount_view;

	/** 签约编号 */
	TextView signedCode_view;

	/** 签约房源 */
	TextView signedHouses_view;

	/** 计价面积 */
	TextView calculateArea_view;

	/** 折前单价 */
	TextView discountPrice_view;

	/** 折前总价 */
	TextView discountTotalPrice_view;

	/** 客户名称 */
	TextView customerName_view;

	/** 证件类型 */
	TextView zj_type;

	/** 证件号码 */
	TextView documentNumber_view;

	/** 手机号码 */
	TextView mobile_view;

	/** 邮寄地址 */
	TextView mailPost_views;

	/** 邮编 */
	TextView postcode_view;

	/** 折扣金额 */
	TextView discountAmount_view;

	/** 折扣比例 */
	TextView discountRate_view;

	/** 折扣说明 */
	TextView discountNote_view;

	/** 签约单价 */
	TextView signPrice_view;

	/** 合同金额 */
	TextView contractAmount_view;

	/** 一次性付款 */
	LinearLayout onest_pay;

	/** 付款方式 */
	TextView paymentMethod_view;

	/** 商业首付 */
	TextView s_first_pay2;

	/** 商业按揭 */
	TextView work_pay2;

	/** 付款方式 */
	TextView pay_type;

	/** 首付 */
	TextView first_pay1;

	/** 公积金按揭 */
	TextView ggj_pay1;

	/** 组合贷款 */
	View include_zuhedaikuan;

	/** 组合贷款首付款应收日期 */
	TextView shoufu_1;

	/** 组合带看商业按揭款应收日期 */
	TextView shangye_1;

	/** 组合带看公积金按揭款应收日期 */
	TextView gongjijin_1;

	/** 商业贷款首付款应收日期 */
	View include_shangyedaikuan;

	/** 商业贷款首付款应收日期 */
	TextView shoufu_2;

	/** 商业贷款商业按揭款应收日期 */
	TextView shangye_2;

	/** 公积金贷款 */
	View include_gongjijindaikuan;

	/** 公积金贷款首付款应收日期 */
	TextView shoufu_3;

	/** 公积金贷款公积金按揭应收日期 */
	TextView gongjijin_3;

	/** 组合首付 */
	TextView zuhe_pay1s;

	/** 组合商业按揭 */
	TextView zuhe_pay2s;

	/** 组合公积金按揭 */
	TextView zuhe_pay3s;

	/** 分期付款 */
	View include_fenqifukuan;

	LinearLayout fenqi2, fenqi3, fenqi4, fenqi5;

	/** 分期付款一期款 */
	TextView pay_date_1;

	/** 分期付款二期款 */
	TextView pay_date_2;

	/** 分期付款三期款 */
	TextView pay_date_3;

	/** 分期付款四期款 */
	TextView pay_date_4;

	/** 分期付款五期款 */
	TextView pay_date_5;

	/** 分期付款一期款应收日期 */
	TextView fenqi_1;

	/** 分期付款二期款应收日期 */
	TextView fenqi_2;

	/** 分期付款三期款应收日期 */
	TextView fenqi_3;

	/** 分期付款四期款应收日期 */
	TextView fenqi_4;

	/** 分期付款五期款应收日期 */
	TextView fenqi_5;

	/** 一次性付款应收金额 */
	TextView is_getprice;

	/** 一次性付款应收时间 */
	TextView p_jjrmine;

	/** 折扣审批 */
	LinearLayout discount_linear;

	/** 折扣审批状态 */
	TextView zekoutype_view;

	/** 折扣审批人 */
	TextView shenpi_p_view;

	/** 折扣审批时间 */
	TextView shenpi_time_view;

	/** 成交类型 */
	TextView pad_type_fund;

	/** 经纪人 */
	TextView agentId_view;

	/** 签约日期 */
	TextView qianyue_time;

	/** 备注 */
	TextView remark_view;

	/** 审核状态 */
	TextView auditStatus_view;

	/** 审核理由 */
	TextView auditReason_view;

	/** 审核人 */
	TextView auditId_view;

	/** 审核时间 */
	TextView auditTime_view;

	LinearLayout buttom_select;

	/** 申请驳回 */
	TextView reject_btn;

	/** 审核通过 */
	TextView is_sure;

	/** 是否从审核列表过来 1 是，0否 */
	private String IsToExamine = "0";

	/** 1待提交 2待审核 3驳回 4成功 */
	private int opentype = 0;

	/** 竖线 */
	TextView v_lins;

	/** 认筹编号 */
	LinearLayout payDepositCode_linear;

	View payDepositcode_lines;

	/** 认筹金 */
	LinearLayout payDepositMoney_linearl;

	View payDepositMoney_lines;

	/** 认购编号 */
	LinearLayout subscribeCode_lieanr;

	View subscribeCode_lines;

	/** 应收定金 */
	LinearLayout subscribeAmount_lieanr;

	View subscribeAmount_lines;

	/*--------------------------------------------------------------------------------------------------*/

	private String taskId;

	LinearLayout callphone_7;

	MyListView jj_list;

	/** 已收 认筹或认购 */
	LinearLayout realAmount_linearlayout;

	TextView realAmount_name_view;

	/** 已收 认筹或认购 */
	TextView realAmount_view;

	TextView discountAmount_all_view;
	LinearLayout reference_linear_layout, discountAmount_all_view_linear;

	/** 推荐人 */
	TextView referenceName;

	/** 推荐人分佣比例 */
	TextView referenceProportion;
	LinearLayout discountNote_linear;

	String customerId = "";

	TextView type_code;

	/** 审核信息 */
	private boolean IsAuditing = true;

	/** 审核信息title */
	LinearLayout auditing_view;

	/** 审核信息内容 */
	LinearLayout auditing_c_layout;

	/** 图片附件数量 */
	TextView image_num;

	/** 无附件显示 */
	LinearLayout image_layout;

	/** 附件布局 */
	LinearLayout annex_layout;

	/** 附件列表 */
	MyListView annexList_list;

	/** 附件数量 */
	TextView annexNum_view;

	/** 侧滑关闭框架 */
	private SwipeBackLayout mSwipeBackLayout;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sigend_details_activity);

		SetSwipeBackLayout(mSwipeBackLayout);

		BaseActivity.activity = this;

		signId = getIntent().getStringExtra("signId");

		IsToExamine = getIntent().getStringExtra("IsToExamine");

		taskId = getIntent().getStringExtra("taskId");

		customerId = getIntent().getStringExtra("customerId");

		initView();
		initView2();

		SetRelativiLayoutPadding(R.id.main_head_top_rela);

		initBtn();

		GetSignedDetail(signId);
	}

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 初始化view
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @author tangxin
	 * @date 2016年12月7日 下午4:44:26
	 */
	private void initView() {
		grid_phone = (MyGridView) findViewById(R.id.grid_phone);
		fangyuan = (LinearLayout) findViewById(R.id.fangyuan);
		fangyuan_layout = (LinearLayout) findViewById(R.id.fangyuan_layout);
		rt1 = (ImageView) findViewById(R.id.rt1);
		kehu = (LinearLayout) findViewById(R.id.kehu);
		kehu_layout = (LinearLayout) findViewById(R.id.kehu_layout);
		rt2 = (ImageView) findViewById(R.id.rt2);
		phone = (LinearLayout) findViewById(R.id.phone);
		phone_layout = (RelativeLayout) findViewById(R.id.phone_layout);
		rt1_p = (ImageView) findViewById(R.id.rt1_p);
		back_btn = (ImageView) findViewById(R.id.back_btn);
		title_main = (TextView) findViewById(R.id.title_main);
		title_main.setText(getString(R.string.set_signed_details));
		yewu_type = (LinearLayout) findViewById(R.id.yewu_type);
		yewu_linear = (LinearLayout) findViewById(R.id.yewu_linear);
		yewu_type = (LinearLayout) findViewById(R.id.yewu_type);
		rt0 = (ImageView) findViewById(R.id.rt0);

		user_name = (TextView) findViewById(R.id.user_name);
		yewu_view = (TextView) findViewById(R.id.yewu_view);
		user_star = (TextView) findViewById(R.id.user_star);
		user_sex = (TextView) findViewById(R.id.user_sex);
		user_number = (TextView) findViewById(R.id.user_number);
		customerOrigin_view = (TextView) findViewById(R.id.customerOrigin_view);
		customerStatus_view = (TextView) findViewById(R.id.customerStatus_view);
		payDepositCode_view = (TextView) findViewById(R.id.payDepositCode_view);
		payDepositMoney_view = (TextView) findViewById(R.id.payDepositMoney_view);
		subscribeCode_view = (TextView) findViewById(R.id.subscribeCode_view);
		subscribeAmount_view = (TextView) findViewById(R.id.subscribeAmount_view);
		signedCode_view = (TextView) findViewById(R.id.signedCode_view);
		signedHouses_view = (TextView) findViewById(R.id.signedHouses_view);
		calculateArea_view = (TextView) findViewById(R.id.calculateArea_view);
		discountPrice_view = (TextView) findViewById(R.id.discountPrice_view);
		discountTotalPrice_view = (TextView) findViewById(R.id.discountTotalPrice_view);
		customerName_view = (TextView) findViewById(R.id.customerName_view);
		zj_type = (TextView) findViewById(R.id.zj_type);
		documentNumber_view = (TextView) findViewById(R.id.documentNumber_view);
		mobile_view = (TextView) findViewById(R.id.mobile_view);
		mailPost_views = (TextView) findViewById(R.id.mailPost_views);
		postcode_view = (TextView) findViewById(R.id.postcode_view);
		kehuxinxi = (MyListView) findViewById(R.id.kehuxinxi);
		discountAmount_view = (TextView) findViewById(R.id.discountAmount_view);
		discountRate_view = (TextView) findViewById(R.id.discountRate_view);
		discountNote_view = (TextView) findViewById(R.id.discountNote_view);
		signPrice_view = (TextView) findViewById(R.id.signPrice_view);
		contractAmount_view = (TextView) findViewById(R.id.contractAmount_view);
		paymentMethod_view = (TextView) findViewById(R.id.paymentMethod_view);

		include_zuhedaikuan = findViewById(R.id.include_zuhedaikuan);
		shoufu_1 = (TextView) include_zuhedaikuan.findViewById(R.id.shoufu_1);
		shangye_1 = (TextView) include_zuhedaikuan.findViewById(R.id.shangye_1);
		gongjijin_1 = (TextView) include_zuhedaikuan.findViewById(R.id.gongjijin_1);
		zuhe_pay1s = (TextView) include_zuhedaikuan.findViewById(R.id.zuhe_pay1s);
		zuhe_pay2s = (TextView) include_zuhedaikuan.findViewById(R.id.zuhe_pay2s);
		zuhe_pay3s = (TextView) include_zuhedaikuan.findViewById(R.id.zuhe_pay3s);

		include_shangyedaikuan = findViewById(R.id.include_shangyedaikuan);
		shoufu_2 = (TextView) include_shangyedaikuan.findViewById(R.id.shoufu_2);
		shangye_2 = (TextView) include_shangyedaikuan.findViewById(R.id.shangye_2);
		s_first_pay2 = (TextView) include_shangyedaikuan.findViewById(R.id.s_first_pay2);
		work_pay2 = (TextView) include_shangyedaikuan.findViewById(R.id.work_pay2);

		include_gongjijindaikuan = findViewById(R.id.include_gongjijindaikuan);
		shoufu_3 = (TextView) include_gongjijindaikuan.findViewById(R.id.shoufu_3);
		gongjijin_3 = (TextView) include_gongjijindaikuan.findViewById(R.id.gongjijin_3);

		include_fenqifukuan = findViewById(R.id.include_fenqifukuan);
		fenqi_1 = (TextView) include_fenqifukuan.findViewById(R.id.fenqi_1);
		fenqi_2 = (TextView) include_fenqifukuan.findViewById(R.id.fenqi_2);
		fenqi_3 = (TextView) include_fenqifukuan.findViewById(R.id.fenqi_3);
		fenqi_4 = (TextView) include_fenqifukuan.findViewById(R.id.fenqi_4);
		fenqi_5 = (TextView) include_fenqifukuan.findViewById(R.id.fenqi_5);
		pay_date_1 = (TextView) include_fenqifukuan.findViewById(R.id.pay_date_1);
		pay_date_2 = (TextView) include_fenqifukuan.findViewById(R.id.pay_date_2);
		pay_date_3 = (TextView) include_fenqifukuan.findViewById(R.id.pay_date_3);
		pay_date_4 = (TextView) include_fenqifukuan.findViewById(R.id.pay_date_4);
		pay_date_5 = (TextView) include_fenqifukuan.findViewById(R.id.pay_date_5);
		fenqi2 = (LinearLayout) include_fenqifukuan.findViewById(R.id.fenqi2);
		fenqi3 = (LinearLayout) include_fenqifukuan.findViewById(R.id.fenqi3);
		fenqi4 = (LinearLayout) include_fenqifukuan.findViewById(R.id.fenqi4);
		fenqi5 = (LinearLayout) include_fenqifukuan.findViewById(R.id.fenqi5);

		first_pay1 = (TextView) include_gongjijindaikuan.findViewById(R.id.first_pay1);
		ggj_pay1 = (TextView) include_gongjijindaikuan.findViewById(R.id.ggj_pay1);
		onest_pay = (LinearLayout) findViewById(R.id.onest_pay);
		is_getprice = (TextView) findViewById(R.id.is_getprice);
		p_jjrmine = (TextView) findViewById(R.id.p_jjrmine);

		discount_linear = (LinearLayout) findViewById(R.id.discount_linear);
		zekoutype_view = (TextView) findViewById(R.id.zekoutype_view);
		shenpi_p_view = (TextView) findViewById(R.id.shenpi_p_view);
		shenpi_time_view = (TextView) findViewById(R.id.shenpi_time_view);
		pad_type_fund = (TextView) findViewById(R.id.pad_type_fund);

		agentId_view = (TextView) findViewById(R.id.agentId_view);
		qianyue_time = (TextView) findViewById(R.id.qianyue_time);
		remark_view = (TextView) findViewById(R.id.remark_view);

		auditStatus_view = (TextView) findViewById(R.id.auditStatus_view);
		auditReason_view = (TextView) findViewById(R.id.auditReason_view);
		auditId_view = (TextView) findViewById(R.id.auditId_view);
		auditTime_view = (TextView) findViewById(R.id.auditTime_view);

		buttom_select = (LinearLayout) findViewById(R.id.buttom_select);
		reject_btn = (TextView) findViewById(R.id.reject_btn);
		is_sure = (TextView) findViewById(R.id.is_sure);
		v_lins = (TextView) findViewById(R.id.v_lins);
		phone_tel = (TextView) findViewById(R.id.phone_tel);

		payDepositCode_linear = (LinearLayout) findViewById(R.id.payDepositCode_linear);
		payDepositcode_lines = findViewById(R.id.payDepositcode_lines);
		payDepositMoney_linearl = (LinearLayout) findViewById(R.id.payDepositMoney_linear);
		subscribeCode_lieanr = (LinearLayout) findViewById(R.id.subscribeCode_lieanr);
		subscribeAmount_lieanr = (LinearLayout) findViewById(R.id.subscribeAmount_lieanr);
		payDepositMoney_lines = findViewById(R.id.payDepositMoney_lines);
		subscribeCode_lines = findViewById(R.id.subscribeCode_lines);
		subscribeAmount_lines = findViewById(R.id.subscribeAmount_lines);

		realAmount_linearlayout = (LinearLayout) findViewById(R.id.realAmount_linearlayout);

		realAmount_name_view = (TextView) findViewById(R.id.realAmount_name_view);

		realAmount_view = (TextView) findViewById(R.id.realAmount_view);
		discountAmount_all_view = (TextView) findViewById(R.id.discountAmount_all_view);
		jj_list = (MyListView) findViewById(R.id.jj_list);

		callphone_7 = (LinearLayout) findViewById(R.id.callphone_7);
		discountNote_linear = (LinearLayout) findViewById(R.id.discountNote_linear);
		discountAmount_all_view_linear = (LinearLayout) findViewById(R.id.discountAmount_all_view_linear);
		callphone_7.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (phone_tel.getText().toString() == null || "".equals(phone_tel.getText().toString())
						|| TextUtils.isEmpty(phone_tel.getText().toString())) {
					return;
				}
				EmmApplication.callPhone(phone_tel.getText().toString(), customerId);
			}
		});

		reference_linear_layout = (LinearLayout) findViewById(R.id.reference_linear_layout);

		referenceName = (TextView) findViewById(R.id.referenceName);

		referenceProportion = (TextView) findViewById(R.id.referenceProportion);

		type_code = (TextView) findViewById(R.id.type_code);
		auditing_view = (LinearLayout) findViewById(R.id.auditing_view);
		rt3 = (ImageView) findViewById(R.id.rt3);
		auditing_c_layout = (LinearLayout) findViewById(R.id.auditing_c_layout);
		image_num = (TextView) findViewById(R.id.image_num);
		image_layout = (LinearLayout) findViewById(R.id.image_layout);
		annex_layout = (LinearLayout) findViewById(R.id.annex_layout);
		annexList_list = (MyListView) findViewById(R.id.annexList_list);
		annexNum_view = (TextView) findViewById(R.id.annexNum_view);
	}

	JJAdapter jjadapter;

	ArrayList<com.emm.yixun.mobile.ui.signed.NewSignedActivity.JJInfo> jjlist = new ArrayList<NewSignedActivity.JJInfo>();

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 初始化监听事件
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @author tangxin
	 * @date 2016年12月7日 下午4:45:31
	 */
	private void initBtn() {
		IsOpenOrClose(fangyuan_layout, IsFangyuan, rt1);
		IsOpenOrClose(kehu_layout, IsKehu, rt2);
		IsOpenOrClose(phone_layout, IShtsm, rt1_p);
		IsOpenOrClose(yewu_linear, IsYEWU, rt0);
		IsOpenOrClose(auditing_c_layout, IsAuditing, rt3);
		yewu_type.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				DoKehuYeWu(IsYEWU);
			}
		});
		auditing_view.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				DoAuditing(IsAuditing);
			}
		});
		back_btn.setVisibility(View.VISIBLE);
		back_btn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		fangyuan.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				DoOpenOrClose(IsFangyuan);
			}
		});
		phone.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				DoHTSMOpenOrClose(IShtsm);
			}
		});
		kehu.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				DoKehuOpenOrClose(IsKehu);
			}
		});
		padapter = new PhoneSelectAdapter(SigneDetailsdActivity.this, ap, 0);
		grid_phone.setAdapter(padapter);
		grid_phone.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				if ("1".equals(ap.get(position).getType())) {
					ViewPagerActivity.postion = position;
					ViewPagerActivity.sDrawables.clear();
					for (int u = 0; u < ap.size(); u++) {
						if ("1".equals(ap.get(u).getType())) {
							ViewPagerActivity.sDrawables.add(ap.get(u).getPath());
						}
					}
					Intent intent = new Intent(SigneDetailsdActivity.this, ViewPagerActivity.class);
					startActivity(intent);
				}
			}
		});

		is_sure.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// 1待提交 2待审核 3驳回 4成功
				if (opentype == 1 || opentype == 3) {
					EmmApplication.getsigned = getsigned;
					Intent intent = new Intent();
					intent.putExtra("OpenType", "12");
					intent.putExtra("payDepositId", getsigned.getPayDepositId());
					intent.putExtra("subscribeId", getsigned.getSubscribeId());
					intent.putExtra("signId", signId);
					intent.putExtra("FrdID", getsigned.getRoomId());
					intent.setClass(SigneDetailsdActivity.this, NewSignedActivity.class);
					startActivity(intent);
				} else if (opentype == 4) {
					// EmmApplication.T("敬请期待");
				}
				if ("1".equals(IsToExamine)) {// 从审核列表过来
					popu();
				}

			}
		});

		reject_btn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// 1待提交 2待审核 3驳回 4成功
				if ("1".equals(IsToExamine)) {// 从审核列表过来
					Intent intent = new Intent();
					intent.setClass(SigneDetailsdActivity.this, RejectActivity.class);
					intent.putExtra("businessType", "3");
					intent.putExtra("taskId", taskId);
					intent.putExtra("payDepositId", signId);
					startActivity(intent);
				}
			}
		});

	}

	View view3;
	PopupWindow popu_call;

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 审核通过弹出框
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @author tangxin
	 * @date 2016年12月7日 下午4:46:21
	 */
	private void popu() {
		view3 = LayoutInflater.from(SigneDetailsdActivity.this).inflate(R.layout.is_sure_popu, null);
		popu_call = new PopupWindow(view3, android.support.v4.view.ViewPager.LayoutParams.FILL_PARENT,
				android.support.v4.view.ViewPager.LayoutParams.FILL_PARENT);
		popu_call.setFocusable(true);

		popu_call.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);
		popu_call.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

		popu_call.showAtLocation(view3, Gravity.CENTER, 0, 0);
		popu_call.showAsDropDown(view3, 0, 0);
		popu_call.setFocusable(true);
		popu_call.setOutsideTouchable(true);
		view3.setFocusable(true);
		view3.setFocusableInTouchMode(true);

		view3.setOnKeyListener(new OnKeyListener() {
			@Override
			public boolean onKey(View v, int keyCode, KeyEvent event) {
				if (keyCode == KeyEvent.KEYCODE_BACK) {
				}
				return false;
			}
		});
		// 取消
		TextView dismiss = (TextView) view3.findViewById(R.id.dismiss);
		// 确定
		TextView shuerbtn = (TextView) view3.findViewById(R.id.shuerbtn);
		// 输入框
		final TextView content_ed = (TextView) view3.findViewById(R.id.content_ed);

		dismiss.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				popu_call.dismiss();
			}
		});
		shuerbtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				popu_call.dismiss();
				// 校验成功之后的操作
				businessAudit("签约", "1", content_ed.getText().toString().trim());
			}
		});
	}

	BusinessAudit businessaudit;

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 查看认筹详情接口
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param businessType
	 * @param auditStatus
	 * @param remark
	 * @author tangxin
	 * @date 2016年12月7日 下午4:47:05
	 */
	private void businessAudit(String businessType, String auditStatus, String remark) {
		EmmApplication.updateUrl("businessAudit");
		Map<String, String> map = new HashMap<String, String>();
		map.put("version", EmmApplication.getPackageManager(5));
		map.put("merchantId", EmmApplication.getData(EmmApplication.merchantId));
		map.put("token", EmmApplication.getToken());
		map.put("userId", EmmApplication.getUserId());
		map.put("terminalCode", EmmApplication.getPackageManager(2));
		map.put("projectCode", EmmApplication.getProjectCode());
		map.put("businessId", signId);// 业务ID

		map.put("taskId", taskId);

		map.put("businessType", businessType);
		map.put("auditStatus", auditStatus);
		map.put("remark", remark);
		Map<String, Object> paramsMap = new HashMap<String, Object>();
		paramsMap.put("params", map);
		JSONObject json = new JSONObject(paramsMap);
		String jsonstr = json.toString();
		RequestParams params = new RequestParams();
		params.put("body", jsonstr);
		Log.v("businessAudit-->post", EmmApplication.urlStr + "?body=" + jsonstr);
		AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
		asyncHttpClient.post(EmmApplication.urlStr, params, new AsyncHttpResponseHandler() {
			@Override
			public void onFailure(Throwable error, String content) {
				super.onFailure(error, content);
				Loading.hideDialogForLoading();
				Log.v(TAG, "请求结束error:" + error + "==" + content);
			}

			@Override
			public void onFinish() {
				Loading.hideDialogForLoading();
				Log.v(TAG, "请求结束");
				super.onFinish();
			}

			@Override
			public void onStart() {
				super.onStart();
				Loading.hideDialogForLoading();
				Loading.showDialogForLoading(SigneDetailsdActivity.this, "正在加载...", false, true, 60000);
				Log.v(TAG, "请求开始");
			}

			@Override
			public void onSuccess(String content) {
				super.onSuccess(content);
				if (content == null) {
					return;
				}
				JSONObject jsonObj = JSONObject.parseObject(content);
				JSONObject resData = (JSONObject) jsonObj.get("resData");
				if (resData == null) {
					Log.v(TAG, "信息返回值为空");
					return;
				}
				businessaudit = JSONObject.parseObject(resData.toString(), BusinessAudit.class);
				if ("1".equals(businessaudit.getResult())) {
					Log.v("获取成功", "");
					EmmApplication.T("审核成功");
					EmmApplication.IsReloadToExamine = true;
					finish();
				} else {
					EmmApplication.T(businessaudit.getErrorMsg().toString());
					Log.v("获取失败", "errorCode:" + businessaudit.getErrorCode().toString() + "errorMsg:"
							+ businessaudit.getErrorMsg().toString());
				}
			}
		});
	}

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 判断操作中的客户信息模块的展开状况
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param bl
	 * @author tangxin
	 * @date 2016年12月7日 下午4:47:51
	 */
	private void DoKehuYeWu(boolean bl) {
		if (!bl) {
			IsYEWU = true;
			yewu_linear.setVisibility(View.VISIBLE);
			rt0.setImageResource(R.drawable.j_bottom);
		} else {
			IsYEWU = false;
			yewu_linear.setVisibility(View.GONE);
			rt0.setImageResource(R.drawable.j_top);
		}
	}

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 判断操作中的审核信息模块的展开状况
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param bl
	 * @author tangxin
	 * @date 2016年12月7日 下午4:53:17
	 */
	private void DoAuditing(boolean bl) {
		if (!bl) {
			IsAuditing = true;
			auditing_c_layout.setVisibility(View.VISIBLE);
			rt3.setImageResource(R.drawable.j_bottom);
		} else {
			IsAuditing = false;
			auditing_c_layout.setVisibility(View.GONE);
			rt3.setImageResource(R.drawable.j_top);
		}
	}

	@Override
	protected void onResume() {
		super.onResume();
		BaseActivity.activity = this;
		IntentFilter filter = new IntentFilter(EmmApplication.ON_CREATE_SIGNED_ACTIVITY);
		registerReceiver(mBroadcastReceiver, filter);
		IntentFilter filter2 = new IntentFilter(EmmApplication.SIGNED_FI_NI_ACTIVITY);
		registerReceiver(mBroadcastReceiver, filter2);
	}

	private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
		@Override
		public void onReceive(Context context, Intent intent) {
			String action = intent.getAction();
			if (action.equals(EmmApplication.ON_CREATE_SIGNED_ACTIVITY)) {
				// 刷新动作
				Log.v(TAG, ":-------");
				GetSignedDetail(signId);
			}
			if (action.equals(EmmApplication.SIGNED_FI_NI_ACTIVITY)) {
				Log.v(TAG, ":-------关闭界面");
				EmmApplication.IsReloadToExamine = true;
				finish();
			}
		}
	};

	@Override
	protected void onDestroy() {
		super.onDestroy();
		EmmApplication.IsLoadingFromList = false;// 解除限制
		unregisterReceiver(mBroadcastReceiver);
	}

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 判断各展开状况
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param view
	 * @param bl
	 * @param view2
	 * @author tangxin
	 * @date 2016年12月7日 下午4:48:24
	 */
	private void IsOpenOrClose(View view, boolean bl, ImageView view2) {
		if (bl) {
			view.setVisibility(View.VISIBLE);
			view2.setImageResource(R.drawable.j_bottom);
		} else {
			view.setVisibility(View.GONE);
			view2.setImageResource(R.drawable.j_top);
		}
	}

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 判断操作中的房源模块的展开状况
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param bl
	 * @author tangxin
	 * @date 2016年12月7日 下午4:48:31
	 */
	private void DoOpenOrClose(boolean bl) {
		if (!bl) {
			IsFangyuan = true;
			fangyuan_layout.setVisibility(View.VISIBLE);
			rt1.setImageResource(R.drawable.j_bottom);
		} else {
			IsFangyuan = false;
			fangyuan_layout.setVisibility(View.GONE);
			rt1.setImageResource(R.drawable.j_top);
		}
	}

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 判断操作中的客户信息模块的展开状况
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param bl
	 * @author tangxin
	 * @date 2016年12月7日 下午4:48:42
	 */
	private void DoKehuOpenOrClose(boolean bl) {
		if (!bl) {
			IsKehu = true;
			kehu_layout.setVisibility(View.VISIBLE);
			rt2.setImageResource(R.drawable.j_bottom);
		} else {
			IsKehu = false;
			kehu_layout.setVisibility(View.GONE);
			rt2.setImageResource(R.drawable.j_top);
		}
	}

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 判断操作中的合同扫面件的展开状况
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param bl
	 * @author tangxin
	 * @date 2016年12月7日 下午4:48:52
	 */
	private void DoHTSMOpenOrClose(boolean bl) {
		if (!bl) {
			IShtsm = true;
			phone_layout.setVisibility(View.VISIBLE);
			rt1_p.setImageResource(R.drawable.j_bottom);
		} else {
			IShtsm = false;
			phone_layout.setVisibility(View.GONE);
			rt1_p.setImageResource(R.drawable.j_top);
		}
	}

	/**
	 * 签约详情
	 */
	GetSignedDetail getsigned;

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 签约接口
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @param signId
	 *            签约ID
	 * @author tangxin
	 * @date 2016年12月7日 下午4:49:01
	 */
	private void GetSignedDetail(String signId) {
		EmmApplication.updateUrl("getSignedDetail");
		Map<String, String> map = new HashMap<String, String>();
		map.put("version", EmmApplication.getPackageManager(5));
		map.put("merchantId", EmmApplication.getData(EmmApplication.merchantId));
		map.put("token", EmmApplication.getToken());
		map.put("userId", EmmApplication.getUserId());
		map.put("terminalCode", EmmApplication.getPackageManager(2));
		map.put("projectCode", EmmApplication.getProjectCode());
		map.put("isAudit", IsToExamine);
		map.put("signId", signId);
		Map<String, Object> paramsMap = new HashMap<String, Object>();
		paramsMap.put("params", map);
		JSONObject json = new JSONObject(paramsMap);
		String jsonstr = json.toString();
		RequestParams params = new RequestParams();
		params.put("body", jsonstr);
		Log.v("getSignedDetail-->post", EmmApplication.urlStr + "?body=" + jsonstr);
		AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
		asyncHttpClient.post(EmmApplication.urlStr, params, new AsyncHttpResponseHandler() {
			@Override
			public void onFailure(Throwable error, String content) {
				super.onFailure(error, content);
				Loading.hideDialogForLoading();
				Log.v(TAG, "请求结束error:" + error + "==" + content);
			}

			@Override
			public void onFinish() {
				Loading.hideDialogForLoading();
				Log.v(TAG, "请求结束");
				super.onFinish();
			}

			@Override
			public void onStart() {
				super.onStart();
				Loading.showDialogForLoading(SigneDetailsdActivity.this, "正在加载...", false, true, 60000);
				Log.v(TAG, "请求开始");
			}

			@Override
			public void onSuccess(String content) {
				super.onSuccess(content);
				if (content == null) {
					return;
				}
				Log.v(TAG, content);
				JSONObject jsonObj = JSONObject.parseObject(content);
				JSONObject resData = (JSONObject) jsonObj.get("resData");
				if (resData == null) {
					Log.v(TAG, "信息返回值为空");
					return;
				}

				getsigned = JSONObject.parseObject(resData.toString(), GetSignedDetail.class);

				if ("1".equals(getsigned.getResult())) {
					Log.v("获取成功", "");
					String sttt;
					try {
						sttt = getsigned.getBusReturnType();
					} catch (NullPointerException e) {
						sttt = "0";
					}
					String str = getsigned.getDiscountAfterAmount();
					if (EmmApplication.isNull(str)) {
						discountAmount_all_view.setText(str);
						discountAmount_all_view_linear.setVisibility(View.VISIBLE);
					} else {
						discountAmount_all_view_linear.setVisibility(View.GONE);
					}
					if ("1".equals(sttt)) {// 认筹
						realAmount_linearlayout.setVisibility(View.VISIBLE);
						realAmount_name_view.setText("已收认筹金");
						realAmount_view.setText(getsigned.getRealAmount());
					} else if ("2".equals(sttt)) {// 认购
						realAmount_linearlayout.setVisibility(View.VISIBLE);
						realAmount_name_view.setText("已收认购金");
						realAmount_view.setText(getsigned.getRealAmount());
					} else {
						realAmount_linearlayout.setVisibility(View.GONE);
					}

					if ("".equals(getsigned.getDiscountAfterAmount()) || null == getsigned.getDiscountAfterAmount()
							|| TextUtils.isEmpty(getsigned.getDiscountAfterAmount())) {
					} else {
						String stp = getsigned.getDiscountAfterAmount();
						getsigned.setDiscountAfterAmount(EmmApplication.drop2("" + (Double.valueOf(stp).doubleValue()
						// * 10000
								)));
					}

					if (null == getsigned.getImageList() || getsigned.getImageList().size() <= 0) {
						image_num.setVisibility(View.GONE);
						ArrayList<AddpirModel> listap = new ArrayList<AddpirModel>();
						if (null == padapter) {
							padapter = new PhoneSelectAdapter(SigneDetailsdActivity.this, listap, 0);
							grid_phone.setAdapter(padapter);
						} else {
							padapter.SetDate(listap);
						}
					} else {
						image_layout.setVisibility(View.GONE);
						ap = new ArrayList<AddpirModel>();
						for (int i = 0; i < getsigned.getImageList().size(); i++) {
							AddpirModel a = new AddpirModel();
							a.setIsnet("2");// 是否网络图片
							a.setType("1");// 图片或添加
							a.setPath(getsigned.getImageList().get(i).getSmallUrl());// 图片路径
							ap.add(a);
						}

						image_num.setVisibility(View.VISIBLE);
						image_num.setText(" (" + getsigned.getImageList().size() + ")");
						grid_phone.setNumColumns(1);
						ArrayList<AddpirModel> listap = new ArrayList<AddpirModel>();
						listap.add(ap.get(0));
						if (null == padapter) {
							padapter = new PhoneSelectAdapter(SigneDetailsdActivity.this, listap, 0);
							grid_phone.setAdapter(padapter);
						} else {
							padapter.SetDate(listap);
						}
					}

					jjlist.clear();

					if (null != getsigned.getDealCategoryList() && getsigned.getDealCategoryList().size() > 0) {
						for (int i = 0; i < getsigned.getDealCategoryList().size(); i++) {
							com.emm.yixun.mobile.ui.signed.NewSignedActivity.JJInfo jinfo = new com.emm.yixun.mobile.ui.signed.NewSignedActivity.JJInfo();
							jinfo.setName(getsigned.getDealCategoryList().get(i).getRelationAgentName());
							jinfo.setNumber(getsigned.getDealCategoryList().get(i).getProportionCommission());
							jinfo.setPid(getsigned.getDealCategoryList().get(i).getRelationAgentId());
							jjlist.add(jinfo);
						}
						ArrayList<GetConsultantList.ConsultantList> consultantList = new ArrayList<ConsultantList>();
						jjadapter = new JJAdapter(jjlist, SigneDetailsdActivity.this, consultantList);
						jj_list.setAdapter(jjadapter);
						jjadapter.SetType(1);
					}

					if (null == getsigned.getAnnexNum() || "0".equals(getsigned.getAnnexNum())
							|| "null".equals(getsigned.getAnnexNum())) {
						annex_layout.setVisibility(View.GONE);
						image_layout.setVisibility(View.GONE);
						if (null == getsigned.getImageList() || getsigned.getImageList().size() <= 0) {
							// 显示没有附件图片
							image_layout.setVisibility(View.VISIBLE);
						}
					} else {
						image_layout.setVisibility(View.GONE);
						annexNum_view.setText("存在以下" + getsigned.getAnnexNum() + "个非图片附件，请通过电脑端查看");
						annex_layout.setVisibility(View.VISIBLE);
						AnnexAdapter annexAdapter = new AnnexAdapter(SigneDetailsdActivity.this, getsigned
								.getAnnexList());
						annexList_list.setAdapter(annexAdapter);
					}

					yewu_view.setText(getsigned.getBusinessStatus());
					user_name.setText(getsigned.getCustomerName());
					user_star.setVisibility("是".equals(getsigned.getCustomerStar()) == true ? View.VISIBLE
							: View.INVISIBLE);
					user_sex.setText(getsigned.getCustomerSex());
					user_number.setText(getsigned.getIntentionLevel());
					customerOrigin_view.setText(getsigned.getCustomerOrigin());
					customerStatus_view.setText(getsigned.getCustomerStatus());
					phone_tel.setText(getsigned.getCustomerPhone());

					if ("".equals(getsigned.getPayDepositCode()) || "null".equals(getsigned.getPayDepositCode())
							|| TextUtils.isEmpty(getsigned.getPayDepositCode())) {
						payDepositCode_linear.setVisibility(View.GONE);
						payDepositcode_lines.setVisibility(View.GONE);
					} else {
						payDepositcode_lines.setVisibility(View.VISIBLE);
						payDepositCode_linear.setVisibility(View.VISIBLE);
						payDepositCode_view.setText(getsigned.getPayDepositCode());
					}

					if ("".equals(getsigned.getPayDepositMoney()) || "null".equals(getsigned.getPayDepositMoney())
							|| TextUtils.isEmpty(getsigned.getPayDepositMoney())) {
						payDepositMoney_linearl.setVisibility(View.GONE);
						payDepositMoney_lines.setVisibility(View.GONE);
					} else {
						payDepositMoney_linearl.setVisibility(View.VISIBLE);
						payDepositMoney_lines.setVisibility(View.VISIBLE);
						payDepositMoney_view.setText(getsigned.getPayDepositMoney());
					}

					if ("".equals(getsigned.getSubscribeCode()) || "null".equals(getsigned.getSubscribeCode())
							|| TextUtils.isEmpty(getsigned.getSubscribeCode())) {
						subscribeCode_lieanr.setVisibility(View.GONE);
						subscribeCode_lines.setVisibility(View.GONE);
					} else {
						subscribeCode_lieanr.setVisibility(View.VISIBLE);
						subscribeCode_lines.setVisibility(View.VISIBLE);
						subscribeCode_view.setText(getsigned.getSubscribeCode());
					}

					if ("".equals(getsigned.getSubscribeAmount()) || "null".equals(getsigned.getSubscribeAmount())
							|| TextUtils.isEmpty(getsigned.getSubscribeAmount())) {
						subscribeAmount_lieanr.setVisibility(View.GONE);
						subscribeAmount_lines.setVisibility(View.GONE);
					} else {
						subscribeAmount_lieanr.setVisibility(View.VISIBLE);
						subscribeAmount_lines.setVisibility(View.VISIBLE);
						subscribeAmount_view.setText(getsigned.getSubscribeAmount());
					}

					signedCode_view.setText(getsigned.getSignedCode());
					signedHouses_view.setText(getsigned.getSignedHouses());
					calculateArea_view.setText(getsigned.getCalculateArea());
					discountPrice_view.setText(getsigned.getDiscountPrice());
					discountTotalPrice_view.setText(getsigned.getDiscountTotalPrice());
					customerName_view.setText(getsigned.getCustomerName());
					zj_type.setText(getsigned.getDocumentType());
					documentNumber_view.setText(getsigned.getDocumentNumber());
					mobile_view.setText(getsigned.getMobile());
					mailPost_views.setText(getsigned.getMailPost());
					postcode_view.setText(getsigned.getPostcode());

					if (null != getsigned.getCustomerFamilyList() && getsigned.getCustomerFamilyList().size() > 0) {

						ArrayList<NewClassKehuModel> list = new ArrayList<NewClassKehuModel>();
						for (int i = 0; i < getsigned.getCustomerFamilyList().size(); i++) {
							NewClassKehuModel m = new NewClassKehuModel();
							m.setCode(getsigned.getCustomerFamilyList().get(i).getDocumentNumber());
							m.setName(getsigned.getCustomerFamilyList().get(i).getMemberName());
							m.setNumber("" + (i + 1));
							m.setType(getsigned.getCustomerFamilyList().get(i).getDocumentType());
							list.add(m);
						}
						adapter = new NewFromAdapter(SigneDetailsdActivity.this, list);
						kehuxinxi.setAdapter(adapter);
						adapter.SetType(1);
					}
					discountAmount_view.setText(getsigned.getDiscountAmount());

					discountRate_view.setText(EmmApplication.isNull(getsigned.getAddDiscountRate()) ? getsigned
							.getAddDiscountRate() : "0");// 折扣比例

					if ("".equals(getsigned.getDiscountNote()) || "null".equals(getsigned.getDiscountNote())
							|| null == getsigned.getDiscountNote()) {
						discountNote_view.setVisibility(View.GONE);
						discountNote_linear.setVisibility(View.GONE);
					} else {
						discountNote_view.setVisibility(View.VISIBLE);
						discountNote_linear.setVisibility(View.VISIBLE);
						discountNote_view.setText(getsigned.getDiscountNote());
					}

					signPrice_view.setText(getsigned.getSignPrice());
					contractAmount_view.setText(getsigned.getContractAmount());
					String paymentMethod = getsigned.getPaymentMethod();
					paymentMethod_view.setText(paymentMethod);

					onest_pay.setVisibility("一次性付款".equals(paymentMethod) ? View.VISIBLE : View.GONE);
					include_zuhedaikuan.setVisibility("组合贷款".equals(paymentMethod) ? View.VISIBLE : View.GONE);
					include_shangyedaikuan.setVisibility("商业按揭".equals(paymentMethod) ? View.VISIBLE : View.GONE);
					include_gongjijindaikuan.setVisibility("公积金按揭".equals(paymentMethod) ? View.VISIBLE : View.GONE);
					include_fenqifukuan.setVisibility("分期付款".equals(paymentMethod) ? View.VISIBLE : View.GONE);

					if ("组合贷款".equals(paymentMethod)) {
						if (null != getsigned.getPaymentMethodList()) {
							for (int i = 0; i < getsigned.getPaymentMethodList().size(); i++) {
								if ("首付".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "组合贷款首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									zuhe_pay1s.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									shoufu_1.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									zuhe_w_1.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									zuhe_w_2.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
								if ("银行按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "商业按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "组合贷款银行按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "组合贷款按揭银行".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									zuhe_pay2s.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									shangye_1.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									zuhe_w_3.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									zuhe_w_4.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
								if ("组合贷款公积金按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "公积金".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									zuhe_pay3s.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									gongjijin_1.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									zuhe_w_5.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									zuhe_w_6.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
							}
						} else {
							Log.v(TAG, "组合贷款  支付list为空");
						}
					} else if ("一次性付款".equals(paymentMethod) || "一次性全款".equals(paymentMethod)) {
						if (null != getsigned.getPaymentMethodList() && getsigned.getPaymentMethodList().size() > 0) {
							is_getprice.setText(getsigned.getPaymentMethodList().get(0).getReceivable());
							String styy = getsigned.getPaymentMethodList().get(0).getReceivableDate();
							p_jjrmine.setText(styy);
							yc_x_1.setText(getsigned.getPaymentMethodList().get(0).getRealAmount() + "元");
							yc_x_2.setText(getsigned.getPaymentMethodList().get(0).getNotRealAmount() + "元");
						} else {
							Log.v(TAG, "一次性付款  支付list为空");
						}
					} else if ("商业按揭".equals(paymentMethod)) {
						if (null != getsigned.getPaymentMethodList()) {
							for (int i = 0; i < getsigned.getPaymentMethodList().size(); i++) {
								if ("首付".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "商业按揭首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "商业贷款首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									s_first_pay2.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									shoufu_2.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									sy_x_1.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									sy_x_2.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
								if ("银行按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "商业按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "商业按揭按揭银行".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "商业按揭银行按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "商业贷款按揭款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									work_pay2.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									shangye_2.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									sy_x_3.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									sy_x_4.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
							}
						} else {
							Log.v(TAG, "商业贷款  支付list为空");
						}
					} else if ("公积金按揭".equals(paymentMethod)) {
						if (null != getsigned.getPaymentMethodList()) {
							for (int i = 0; i < getsigned.getPaymentMethodList().size(); i++) {
								if ("首付".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "公积金按揭首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "公积金首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "首付款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									first_pay1.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									shoufu_3.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									gjj_x_1.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									gjj_x_2.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
								if ("公积金按揭公积金按揭".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "公积金".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "公积金按揭款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									ggj_pay1.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									gongjijin_3.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									gjj_x_3.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									gjj_x_4.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
							}
						} else {
							Log.v(TAG, "公积金贷款  支付list为空");
						}
					} else if ("分期付款".equals(paymentMethod)) {
						if (null != getsigned.getPaymentMethodList()) {
							if (getsigned.getPaymentMethodList().size() == 1) {
								fenqi2.setVisibility(View.GONE);
								fenqi3.setVisibility(View.GONE);
								fenqi4.setVisibility(View.GONE);
								fenqi5.setVisibility(View.GONE);
							} else if (getsigned.getPaymentMethodList().size() == 2) {
								fenqi3.setVisibility(View.GONE);
								fenqi4.setVisibility(View.GONE);
								fenqi5.setVisibility(View.GONE);
							} else if (getsigned.getPaymentMethodList().size() == 3) {
								fenqi4.setVisibility(View.GONE);
								fenqi5.setVisibility(View.GONE);
							} else if (getsigned.getPaymentMethodList().size() == 4) {
								fenqi5.setVisibility(View.GONE);
							}
							for (int i = 0; i < getsigned.getPaymentMethodList().size(); i++) {
								if ("一期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期付款一期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期一期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									pay_date_1.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									fenqi_1.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									fq_x_1.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									fq_x_2.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								} else if ("二期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期付款二期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期二期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									pay_date_2.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									fenqi_2.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									fq_x_3.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									fq_x_4.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								} else if ("三期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期付款三期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期三期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									pay_date_3.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									fenqi_3.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									fq_x_5.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									fq_x_6.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								} else if ("四期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期付款四期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期四期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									pay_date_4.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									fenqi_4.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									fq_x_7.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									fq_x_8.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								} else if ("五期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期付款五期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())
										|| "分期五期款".equals(getsigned.getPaymentMethodList().get(i).getPayContent())) {
									pay_date_5.setText(getsigned.getPaymentMethodList().get(i).getReceivable());
									fenqi_5.setText(getsigned.getPaymentMethodList().get(i).getReceivableDate());
									fq_x_9.setText(getsigned.getPaymentMethodList().get(i).getRealAmount() + "元");
									fq_x_10.setText(getsigned.getPaymentMethodList().get(i).getNotRealAmount() + "元");
								}
							}
						} else {
							Log.v(TAG, "分期付款  支付list为空");
						}
					}

					if ("1".equals(getsigned.getDiscountApproval())) {
						discount_linear.setVisibility(View.VISIBLE);
						zekoutype_view.setText(getsigned.getDiscountApprovalStatus());
						shenpi_p_view.setText(getsigned.getDiscountApprovalPeople());
						shenpi_time_view.setText(getsigned.getDiscountApprovalTime());
					} else {
						discount_linear.setVisibility(View.GONE);
					}

					pad_type_fund.setText(getsigned.getDealCategory());
					if ("推荐成交".equals(pad_type_fund.getText().toString().trim())) {
						reference_linear_layout.setVisibility(View.VISIBLE);
						referenceName.setText(getsigned.getReferenceName());
						referenceProportion.setText(EmmApplication.drop2(getsigned.getReferenceProportion()));
					} else {
						reference_linear_layout.setVisibility(View.GONE);
					}
					agentId_view.setText(getsigned.getAgent());

					qianyue_time.setText(getsigned.getSignedDate());
					if (EmmApplication.isNull(getsigned.getRemark())) {
						remark_view.setTextColor(getResources().getColor(R.color.text_right));
						remark_view.setText(getsigned.getRemark());
					} else {
						remark_view.setTextColor(getResources().getColor(R.color.edittext_hint_color));
						remark_view.setText("暂无备注");
					}

					auditStatus_view.setText(getsigned.getAuditStatus());

					auditReason_view.setText(getsigned.getAuditReason());

					auditId_view.setText(getsigned.getAudit());

					auditTime_view.setText(getsigned.getAuditTime());

					if ("1".equals(IsToExamine)) {
						buttom_select.setVisibility(View.VISIBLE);
						is_sure.setVisibility(View.VISIBLE);
						is_sure.setText("审核通过");
						reject_btn.setVisibility(View.VISIBLE);
						reject_btn.setText("审核退回");
					} else {
						// 待提交 待审核 驳回 成功
						if ("待提交".equals(getsigned.getAuditStatus())) {
							buttom_select.setVisibility(View.VISIBLE);
							v_lins.setVisibility(View.GONE);
							reject_btn.setVisibility(View.GONE);
							is_sure.setVisibility(View.VISIBLE);
							is_sure.setText("签约");
							opentype = 1;
						} else if ("审核中".equals(getsigned.getAuditStatus())) {
							opentype = 2;
							buttom_select.setVisibility(View.GONE);
						} else if ("已退回".equals(getsigned.getAuditStatus())
								|| (null != getsigned.getDiscountApprovalStatus() && "已退回".equals(getsigned
										.getDiscountApprovalStatus()))) {
							opentype = 3;
							buttom_select.setVisibility(View.VISIBLE);
							v_lins.setVisibility(View.GONE);
							reject_btn.setVisibility(View.GONE);
							is_sure.setVisibility(View.VISIBLE);
							is_sure.setText("签约");
						} else if ("已通过".equals(getsigned.getAuditStatus())) {
							opentype = 4;
							buttom_select.setVisibility(View.GONE);
							v_lins.setVisibility(View.GONE);
							reject_btn.setVisibility(View.GONE);
							is_sure.setVisibility(View.GONE);
							is_sure.setText("认购");
							reject_btn.setText("签约");
						} else {// 在没有该字段的情况下，不可展示其他界面入口
							buttom_select.setVisibility(View.GONE);
						}
					}

				} else {
					EmmApplication.T(getsigned.getErrorMsg().toString());
					Log.v("获取失败", "errorCode:" + getsigned.getErrorCode().toString() + "errorMsg:"
							+ getsigned.getErrorMsg().toString());
				}
			}
		});
	}

	/** 组合 首付已收 */
	TextView zuhe_w_1;

	/** 组合 首付未收 */
	TextView zuhe_w_2;

	/** 组合 商业已收 */
	TextView zuhe_w_3;

	/** 组合 商业未收 */
	TextView zuhe_w_4;

	/** 组合 公积金已收 */
	TextView zuhe_w_5;

	/** 组合 公积金未收 */
	TextView zuhe_w_6;

	/** 一次性已收 */
	TextView yc_x_1;

	/** 一次性未收 */
	TextView yc_x_2;

	/** 商业首付已收 */
	TextView sy_x_1;

	/** 商业首付未收 */
	TextView sy_x_2;

	/** 商业已收 */
	TextView sy_x_3;

	/** 商业未收 */
	TextView sy_x_4;

	/** 公积金首付已收 */
	TextView gjj_x_1;

	/** 公积金首付未收 */
	TextView gjj_x_2;

	/** 公积金已收 */
	TextView gjj_x_3;

	/** 公积金未收 */
	TextView gjj_x_4;

	/** 分期一期款已收 */
	TextView fq_x_1;

	/** 分期一期款未收 */
	TextView fq_x_2;

	/** 分期二期款已收 */
	TextView fq_x_3;

	/** 分期二期款未收 */
	TextView fq_x_4;

	/** 分期三期款已收 */
	TextView fq_x_5;

	/** 分期三期款未收 */
	TextView fq_x_6;

	/** 分期四期款已收 */
	TextView fq_x_7;

	/** 分期四期款未收 */
	TextView fq_x_8;

	/** 分期五期款已收 */
	TextView fq_x_9;

	/** 分期五期款未收 */
	TextView fq_x_10;

	/**
	 * 
	 * <p>
	 * <b>Title：</b> 初始化view
	 * </p>
	 * <p>
	 * <b>Description：</b>
	 * </p>
	 * 
	 * @author tangxin
	 * @date 2016年12月7日 下午4:49:41
	 */
	private void initView2() {
		zuhe_w_1 = (TextView) findViewById(R.id.zuhe_w_1);
		zuhe_w_2 = (TextView) findViewById(R.id.zuhe_w_2);
		zuhe_w_3 = (TextView) findViewById(R.id.zuhe_w_3);
		zuhe_w_4 = (TextView) findViewById(R.id.zuhe_w_4);
		zuhe_w_5 = (TextView) findViewById(R.id.zuhe_w_5);
		zuhe_w_6 = (TextView) findViewById(R.id.zuhe_w_6);
		yc_x_1 = (TextView) findViewById(R.id.yc_x_1);
		yc_x_2 = (TextView) findViewById(R.id.yc_x_2);
		sy_x_1 = (TextView) findViewById(R.id.sy_x_1);
		sy_x_2 = (TextView) findViewById(R.id.sy_x_2);
		sy_x_3 = (TextView) findViewById(R.id.sy_x_3);
		sy_x_4 = (TextView) findViewById(R.id.sy_x_4);
		gjj_x_1 = (TextView) findViewById(R.id.gjj_x_1);
		gjj_x_2 = (TextView) findViewById(R.id.gjj_x_2);
		gjj_x_3 = (TextView) findViewById(R.id.gjj_x_3);
		gjj_x_4 = (TextView) findViewById(R.id.gjj_x_4);
		fq_x_1 = (TextView) findViewById(R.id.fq_x_1);
		fq_x_2 = (TextView) findViewById(R.id.fq_x_2);
		fq_x_3 = (TextView) findViewById(R.id.fq_x_3);
		fq_x_4 = (TextView) findViewById(R.id.fq_x_4);
		fq_x_5 = (TextView) findViewById(R.id.fq_x_5);
		fq_x_6 = (TextView) findViewById(R.id.fq_x_6);
		fq_x_7 = (TextView) findViewById(R.id.fq_x_7);
		fq_x_8 = (TextView) findViewById(R.id.fq_x_8);
		fq_x_9 = (TextView) findViewById(R.id.fq_x_9);
		fq_x_10 = (TextView) findViewById(R.id.fq_x_10);
	}

}
